<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>从SESSION中获取值</h1>
<span th:text="${#session.getAttribute('data')}"></span><br/>
<span th:text="${#httpSession.getAttribute('data')}"></span><br/>
<span th:text="${session.data}"></span><br/>

<script type="text/javascript" th:inline="javascript">
    // http://localhost:8080/springboot/user/detail
    //获取协议名称
    var scheme = [[${#request.getScheme()}]];

    //获取服务器名称
    var serverName = [[${#request.getServerName()}]];

    //获取服务器端口号
    var serverPort = [[${#request.getServerPort()}]];

    //获取上下文根
    var contextPath = [[${#request.getContextPath()}]];

    var allPath = scheme + "://" +serverName+":"+serverPort+contextPath;

    var requestURL = [[${#httpServletRequest.requestURL}]];
    var queryString = [[${#httpServletRequest.queryString}]];

    var requestAddress = requestURL + "?" +queryString;

    alert(requestAddress);


</script>
</body>
</html>